package cn.buk.tms.entity.misc;

import com.fasterxml.jackson.annotation.JsonFormat;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.util.Date;

/**
 * 客户服务收费模板包含的机票特定规则
 * 
 * @author yfdai
 */
@Entity
@Table(name = "customer_service_flight_rule",
        uniqueConstraints = @UniqueConstraint(
                name = "uk_customer_service_flight_rule",
                columnNames = {"enterprise_id", "template_code", "carrier"}))
public class CustomerServiceFlightRule {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(name = "enterprise_id", nullable = false)
    private int enterpriseId;

    /**
     * 模板代码：A、B等
     */
    @Column(name = "template_code", length = 5, nullable = false, updatable = false)
    private String templateCode;

    /**
     * 航司代码
     */
    @Column(length = 2, nullable = false)
    private String carrier;

    /**
     * 舱位代码，可以有多个舱位, 用空格、逗号或斜线隔开
     */
    @Column(length = 30, nullable = false)
    private String subclasses;

    /**
     * 机票出票服务费(每人每段）
     */
    @Column(name = "flt_ticketing_fee")
    private int flightTicketingFee;

    /**
     * 机票退票服务费（每人每段）
     */
    @Column(name = "flt_refund_free")
    private int flightRefundFee;

    /**
     * 机票更改服务费（每人每段）
     */
    @Column(name = "flt_change_fee")
    private int flightChangeFee;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "last_update", insertable = false)
    private Date lastUpdate;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }



    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public String getTemplateCode() {
        return templateCode;
    }

    public void setTemplateCode(String templateCode) {
        if (templateCode != null) {
            this.templateCode = templateCode.trim().toUpperCase();
        }
    }

    public int getFlightTicketingFee() {
        return flightTicketingFee;
    }

    public void setFlightTicketingFee(int flightTicketingFee) {
        this.flightTicketingFee = flightTicketingFee;
    }

    public int getFlightRefundFee() {
        return flightRefundFee;
    }

    public void setFlightRefundFee(int flightRefundFee) {
        this.flightRefundFee = flightRefundFee;
    }

    public int getFlightChangeFee() {
        return flightChangeFee;
    }

    public void setFlightChangeFee(int flightChangeFee) {
        this.flightChangeFee = flightChangeFee;
    }

    public String getCarrier() {
        return carrier;
    }

    public void setCarrier(@NotNull String carrier) {
        this.carrier = carrier.trim().toUpperCase();
    }

    public String getSubclasses() {
        return subclasses;
    }

    public void setSubclasses(@NotNull String subclasses) {
        this.subclasses = subclasses.trim().toUpperCase();
    }
}
